<%@ page language="java" pageEncoding="utf-8" %>
<%@ include file="../../common/head_admin.jsp" %>
<link rel="stylesheet" type="text/css" href="../css/admin.css" />
<script type="text/javascript">
	$(document).ready(function(){
$.formValidator.initConfig({formid:"form1",onError:function(){alert("具体错误请看提示!")}});
		//点击获取脚本按钮，获取校验代码
$("#userName").formValidator({onshow:"请输入用户名",onfocus:"用户名不能为空",oncorrect:"用户名合法"}).inputValidator({min:1,empty:{leftempty:false,rightempty:false,emptyerror:"用户名两边不能有空符号"},onerror:"用户名不能为空,请确认"}).ajaxValidator({
	    type : "get",
		url : "${ctx}/manage/user/checkUserName.do",
		datatype : "json",
		success : function(data){	
            if( data == "0" )
			{		
                return true;
			}
            else
			{
                return false;
			}
		},	
		error: function(){alert("服务器没有返回数据，可能服务器忙，请重试");},
		onerror : "该用户名已存在，请更换用户名",
		onwait : "正在对用户名进行合法性校验，请稍候..."
	});

$("#password1").formValidator({onshow:"请输入密码",onfocus:"密码不能为空",oncorrect:"密码合法"}).inputValidator({min:1,empty:{leftempty:false,rightempty:false,emptyerror:"密码两边不能有空符号"},onerror:"密码不能为空,请确认"});

$("#password2").formValidator({onshow:"请输入重复密码",onfocus:"两次密码必须一致哦",oncorrect:"密码一致"}).inputValidator({min:1,empty:{leftempty:false,rightempty:false,emptyerror:"重复密码两边不能有空符号"},onerror:"重复密码不能为空,请确认"}).compareValidator({desid:"password1",operateor:"=",onerror:"2次密码不一致,请确认"});

});	

</script>
<div id="admin_right">
<div class="headbar clearfix">
	<div class="position"><span>后台首页</span><span>></span><span>用户管理</span><span>></span><span>添加用户</span></div>
	<ul class="tab" name="menu1">
		<li id="li_1" class="selected"><a href="javascript:void(0)" hidefocus="true" onclick="select_tab('1')">添加用户</a></li>
	</ul>
</div>

<div class="content_box">
	<div class="content form_content">
      <form name="form1" id="form1" method="post" action="${ctx }/manage/user/add.do">
			<div id="table_box_1">
			<table class="form_table">
				<col width="150px" />
				<col />
				<tr>
					<th>用户名：</th>
					<td><input type="text" id="userName" name="user_name" class="normal" value="" /><td><div id="userNameTip" style="width:250px"></div></td>
					</td>
				</tr>
				<tr>
					<th>密  码：</th>
					<td><input class="normal"  type="password" name="user_password" id="password1"  /><td><div id="password1Tip" style="width:250px"></div></td>
				</tr>
				<tr>
					<th>重复密码：</th>
					<td><input class="normal"  type="password"  id="password2"  /><td><div id="password2Tip" style="width:250px"></div></td>
				</tr>
				<tr>
					<th>用户权限：</th>
                    <td>
						<select style="width:120px" name="groupMode" id="groupMode">
                            <option value="1" >超级管理员</option>
                            <option value="2" >普通管理员</option>
                            <option value="3" >注册用户</option>
                        </select>
					</td>
				</tr>
				<tr>
					<th>电子邮箱：</th><td><input class="normal" type="text" id="email" name="user_email" /><label><div id="emailTip" style="width:250px"></div></label></td>
				</tr>
             </table>
			<table class="form_table">
				<col width="150px" />
				<col />
				<tr>
					<td></td><td><button class="submit"  type="submit" name="button" id="button" onclick="return checkForm()"><span>添加</span></button></td>
				</tr>
			</table>
		</form>
          </div>
	</div>
</div>


	</div>
	<div id="separator"></div>
</div>

<script type='text/javascript'>
	//隔行换色
	$(".list_table tr::nth-child(even)").addClass('even');
	$(".list_table tr").hover(
		function () {
			$(this).addClass("sel");
		},
		function () {
			$(this).removeClass("sel");
		}
	);
</script>
</body>
</html>